home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-03 / qbasicpg.zip / DATAEND.BAS < prev    next >
BASIC Source File  |  1989-08-31  |  1KB  |  44 lines

  1. ' DATAEND.BAS
  2. ' This program reads information into three arrays and prints it.
  3. '   The maximum number of names that can be entered is 50; fewer
  4. '   can be entered by typing "END" for the salesperson name.
  5.  
  6. OPTION BASE 1                ' set base of all arrays to 1
  7.  
  8. DIM salesGroup$(50)          ' dimension salesGroup$ string array
  9. DIM bikesSold%(50)           ' dimension bikesSold% integer array
  10. DIM totalSales!(50)          ' dimension totalSales! floating-point array
  11.  
  12. CLS
  13.  
  14. PRINT "Follow prompts to enter bike shop data.  Type END to quit."
  15. PRINT
  16.  
  17. count% = 1                   ' initialize an array counter variable
  18.  
  19. WHILE (salesGroup$(count%) <> "END")  ' continue until name = "END"
  20.     INPUT "Enter salesperson name:  ", salesGroup$(count%)
  21.    
  22.     IF (salesGroup$(count%) <> "END") THEN
  23.         INPUT "   Bikes sold:  ", bikesSold%(count%)
  24.         INPUT "   Total sales:  $", totalSales!(count%)
  25.         PRINT
  26.         count% = count% + 1           ' increment the array counter
  27.     END IF
  28. WEND
  29.  
  30. PRINT
  31. PRINT "You entered the following sales data:"
  32. PRINT
  33. PRINT "Salesperson     Bikes sold     Total sales"
  34. PRINT "------------------------------------------"
  35. PRINT
  36.  
  37. ' initialize tmp$, a formatting template for PRINT USING
  38. tmp$ = "\               \ ###          $$####.##"
  39.  
  40. FOR i% = 1 TO count% - 1     ' print contents of each array
  41.     PRINT USING tmp$; salesGroup$(i%); bikesSold%(i%); totalSales!(i%)
  42. NEXT i%
  43.  
  44.